package cn.consult.sys.service.impl;

import cn.consult.sys.dao.TWeGatewayConfigDao;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.consult.sys.entity.TWeGatewayConfig;
import cn.consult.sys.service.TWeGatewayConfigService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * (TWeGatewayConfig)表服务实现类
 *
 * @author makejava
 * @since 2024-04-09 09:13:14
 */
@Service("tWeGatewayConfigService")
public class TWeGatewayConfigServiceImpl extends ServiceImpl<TWeGatewayConfigDao, TWeGatewayConfig> implements TWeGatewayConfigService {

    @Override
    public IPage<TWeGatewayConfig> selectPage(Map<String, Object> params) {
        LambdaQueryWrapper<TWeGatewayConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.like(params.get("gatewayName") != null && params.get("gatewayName") != "", TWeGatewayConfig::getGatewayName, params.get("gatewayName"));


        Page<TWeGatewayConfig> page = new Page<>();
        page.setCurrent(Long.parseLong(params.get("pageNum").toString()));
        page.setSize(Long.parseLong(params.get("pageSize").toString()));

        Page<TWeGatewayConfig> selectedPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);
        return selectedPage;
    }
}

